//The purpose of dynamic_cast is to deal with the case in which
//the correctness of the conversion cannot be determined by the compiler

//dynamic cast of pointer     dynamic_cast<T*>()  <checked>
//dynamic cast of reference   dynamic_cast<T&>()  <checked>
//dynamic cast of Type        dynamic_cast<T>()

#include <iostream>
#include <typeinfo>
using namespace std;

class A {
  int aa;
public:
  virtual int get(){cout<<"A::aa"<<endl;return aa;}
};

class B : public A{
  int bb;
public:
  int get() {cout<<"B::bb"<<endl; return bb;}
};



int main()
{
  B b;
  A a = dynamic_cast<A>(b);
  //error: cannot dynamic_cast 'b' (of type B) to type A
  //target is not pointer or reference

  return 0;
}
